#!/bin/bash

# 读取参数，执行打包命令
if [ "$1" = "dev" ]; then
  echo "开始打包dev环境"
  yarn run build:dev
else
  echo "开始打包app环境"
  yarn run build
fi

# 移除之前的压缩包
rm tester-*.zip
rm public/tester-*.zip

# 压缩成 .zip 文件
current_time=$(date +%y%m%d)
cd dist/
zip -r ../tester-$current_time.zip js/ css/

# 复制到 public 目录
cd ..
cp tester-*.zip public/
echo "成功打包tester-$current_time.zip"
